package com.lyf.shop.service.impl;

import java.util.List;
import com.lyf.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lyf.shop.mapper.IntegralMapper;
import com.lyf.shop.domain.Integral;
import com.lyf.shop.service.IIntegralService;

/**
 * 积分兑换Service业务层处理
 * 
 * @author lyf
 * @date 2023-04-08
 */
@Service
public class IntegralServiceImpl implements IIntegralService 
{
    @Autowired
    private IntegralMapper integralMapper;

    /**
     * 查询积分兑换
     * 
     * @param integralId 积分兑换主键
     * @return 积分兑换
     */
    @Override
    public Integral selectIntegralByIntegralId(Long integralId)
    {
        return integralMapper.selectIntegralByIntegralId(integralId);
    }

    /**
     * 查询积分兑换列表
     * 
     * @param integral 积分兑换
     * @return 积分兑换
     */
    @Override
    public List<Integral> selectIntegralList(Integral integral)
    {
        return integralMapper.selectIntegralList(integral);
    }

    /**
     * 新增积分兑换
     * 
     * @param integral 积分兑换
     * @return 结果
     */
    @Override
    public int insertIntegral(Integral integral)
    {
        integral.setCreateTime(DateUtils.getNowDate());
        return integralMapper.insertIntegral(integral);
    }

    /**
     * 修改积分兑换
     * 
     * @param integral 积分兑换
     * @return 结果
     */
    @Override
    public int updateIntegral(Integral integral)
    {
        integral.setUpdateTime(DateUtils.getNowDate());
        return integralMapper.updateIntegral(integral);
    }

    /**
     * 批量删除积分兑换
     * 
     * @param integralIds 需要删除的积分兑换主键
     * @return 结果
     */
    @Override
    public int deleteIntegralByIntegralIds(Long[] integralIds)
    {
        return integralMapper.deleteIntegralByIntegralIds(integralIds);
    }

    /**
     * 删除积分兑换信息
     * 
     * @param integralId 积分兑换主键
     * @return 结果
     */
    @Override
    public int deleteIntegralByIntegralId(Long integralId)
    {
        return integralMapper.deleteIntegralByIntegralId(integralId);
    }
}
